/*
* @Author: Leequik
* @Date:   2021-04-09 09:17:32
 * @Last Modified by: 
 * @Last Modified time: 2021-05-12 14:17:20
*/
import home from './router/home'; //home路由
import homechild from './router/homechild';
import backend from './router/backend';

export default [
    {
        path: '/home',
        component: require('./views/home/Main').default,
        beforeEnter: requireAuth,
        onError: (err) => {
            console.log(err);
        },

        children: [
            {
                path: '/',
                component: require('./views/home/Index').default,
                children:[
                    {
                        path:'timeline',
                        components:{
                            default:() => import('./views/home/TimeLine'),
                            sidebar:() => import('./views/home/Sidebar')
                        }
                                                  
                    },
                    ...homechild,
                ]
            },
            {
                path:'logout',
                component:require('./views/home/Login')
            },
            ...home,
        ],   
    },
   
    {
        path:'/crud',
        component:require('./views/test/Crud').default
    },
    {
        path:'/admin/login',
        component:require('./views/backend/Login').default
    },
   

    ...backend,
]

//是否登陆
function requireAuth (to, from, next) {
    //console.log(from);
    //console.log(to);
    //if (window.User) {
    return next();
    //}else{
    //    return next('/')
    //}
}